{% extends 'base.html' %}
{% block title %}自定义奖池{% endblock %}
{% block header %}
    <script src="https://cdn.bootcdn.net/ajax/libs/vue/2.6.11/vue.min.js"></script>
    <script src="https://cdn.bootcdn.net/ajax/libs/axios/0.19.2/axios.min.js"></script>
{% endblock %}
{% block nav4 %}active{% endblock %}
{% block nav8 %}active{% endblock %}
{% block body %}
    <div class="alert alert-custom alert-light-primary fade show mb-5" role="alert">
        <div class="alert-icon"><i class="flaticon-warning"></i></div>
        <div class="alert-text">所有概率都是相对值，即：抽取率 = 当前奖池概率 ÷ 所有奖池总概率</div>
        <div class="alert-close">
            <button type="button" class="close" data-dismiss="alert" aria-label="Close">
                <span aria-hidden="true"><i class="ki ki-close"></i></span>
            </button>
        </div>
    </div>
    <div id="app">
        <div v-for="(pdata, pname) in settings.pool" class="card card-custom">
            <div class="card-header">
                <div class="card-title">
                    <h2>奖池：[[pname]]</h2>
                </div>
                <div class="card-toolbar">
                    <button @click="$delete(settings.pool, pname)" class="btn btn-sm btn-danger font-weight-bold"><i class="flaticon2-rubbish-bin"></i> 删除奖池</button>
                </div>
            </div>
            <div class="card-body">
                    名称：<input v-model="pname" /><br />
                    前缀：<input v-model="pdata.prefix" /><br />
                    单抽概率：<input v-model.number="pdata.prop" /><br />
                    保底抽概率：<input v-model.number="pdata.prop_last" /><br />
                    内容:<br /><input v-for="(item, ikey) in pdata.pool" v-model="pdata.pool[ikey]" />
                    <button @click="pdata.pool.push(null)" class="btn btn-light btn-shadow-hover font-weight-bold mr-2">添加</button>
                    <button @click="pdata.pool.pop()" class="btn btn-light btn-shadow-hover font-weight-bold mr-2">删除</button>

            </div>

        </div>
        <div class="card card-custom">
            <div class="card-body">
                <button @click="addpool" class="btn btn-success">添加奖池</button><br />
                每次抽卡数：<input v-model.number="settings.settings.combo" /><br />
                每日抽卡次数：<input v-model.number="settings.settings.day_limit" /><br />
                <input type="checkbox" v-model.number="settings.settings.shuffle">保底抽位置不固定
            </div>
        </div>
        <button @click="update" class="btn btn-success">保存</button>
    </div>
{% endblock %}
{% block scripts %}
<script>
  var api_path = "{{ url_for('yobot_pool_setting_api') }}";
  var csrf_token = "{{ session['csrf_token'] }}";
</script>
<script src="{{ url_for('yobot_static', filename='admin/pool-setting.js') }}"></script>
{% endblock %}